<%= semantic_form_for(@customer , :html => {:multipart => true}) do |f| %>
<% if @customer.errors.any? %>
<div id="error_explanation">
	<h2><%= pluralize(@customer.errors.count, "error") %> prohibited this customer from being saved:</h2>
	<ul>
		<% @customer.errors.full_messages.each do |msg| %>
		<li>
			<%= msg %>
		</li>
		<% end %>
	</ul>
</div>
<% end %>
<div class="form-left">
	<%= f.inputs t(:personal_information) , :class=>"detail-form" do %>

	<%= f.input :code ,:label => t(:customer_code) ,:hint => t(:auto_generate_by_system) , :input_html => { :disabled => true }%>

	<%= f.input :title ,:label=> t(:title) , :required => true , :input_html => { :disabled => @read_only }%>

	<%= f.input :first_name ,:label=>t(:first_name), :required => true, :input_html => { :disabled => @read_only }%>

	<%= f.input :last_name ,:label=>t(:last_name), :required => true , :input_html => { :disabled => @read_only }%>

	<%= f.input :nick_name ,:label=>t(:nick_name), :input_html => { :disabled => @read_only }%>

	<%= f.input :marr_status ,:label=>t(:marr_status), :as=>'radio', :collection => [[t(:single),"Single"], [t(:married),"Married"]] , :input_html => { :disabled => @read_only }%>

	<%= f.input :birth_date ,:label=>t(:birth_date), :as=>'date' , :start_year => Time.now.year - 100 , :required => true , :input_html => { :disabled => @read_only }%>

	<%= f.input :nationality ,:label=>t(:nationality), :include_blank => false , :required => true , :input_html => { :disabled => @read_only }%>

	<%= f.input :card  ,:label=>t(:card_type),:include_blank => false , :required => true , :input_html => { :disabled => @read_only }%>

	<%= f.input :card_no ,:label=>t(:card_no), :required => true , :input_html => { :disabled => @read_only }%>

	<%= f.input :issue_by ,:label=>t(:issue_by), :required => true , :input_html => { :disabled => @read_only }%>

	<%= f.input :issue_province ,:label=>t(:issue_province), :as => :select,:collection => Province.find(:all) , :input_html => { :disabled => @read_only }%>

	<%= f.input :issue_date ,:label=>t(:issue_date), :as=>'date' , :start_year => Time.now.year - 100 , :input_html => { :disabled => @read_only }%>

	<%= f.input :issue_expire ,:label=>t(:issue_expire), :as=>'date' , :start_year => Time.now.year - 100 , :input_html => { :disabled => @read_only }%>
	<% end %>

	<%= f.inputs "Married" , :class=>"detail-form" ,:id=>'married-form' do %>
	<%= f.input :married_name , :required => true , :input_html => { :disabled => @read_only }%>
	<%= f.input :married_occupation_id , :required => true , :input_html => { :disabled => @read_only }%>
	<%= f.input :married_work_position , :required => true , :input_html => { :disabled => @read_only }%>
	<%= f.input :married_work_name , :required => true , :input_html => { :disabled => @read_only }%>
	<%= f.input :married_work_address , :required => true , :input_html => { :disabled => @read_only }%>
	<%= f.input :married_work_tel_no , :required => true , :input_html => { :disabled => @read_only }%>
	<%= f.input :married_work_start , :required => true , :input_html => { :disabled => @read_only }%>
	<%= f.input :married_work_salary , :required => true , :input_html => { :disabled => @read_only }%>
	<%= f.input :married_other_income , :required => true , :input_html => { :disabled => @read_only }%>
	<% end %>

	<%= f.inputs "Address" , :class=>"detail-form" do %>
	<%= f.input :register_address , :as=>'text' , :required => true  , :input_html => { :disabled => @read_only }%>
	<%= f.input :register_tel_no ,:required => true , :input_html => { :disabled => @read_only }%>

	<%= f.input :register_home_live , :as=>'date' ,:required => true , :input_html => { :disabled => @read_only }%>

	<%= f.input :register_home_position , :required => true , :input_html => { :disabled => @read_only }%>
	<%= f.input :register_home_characteristic , :required => true , :input_html => { :disabled => @read_only }%>
	<%= f.input :register_home_near  , :input_html => { :disabled => @read_only }%>

	<%= f.input :present_address , :as=>'text' , :required => true , :input_html => { :disabled => @read_only }%>
	<%= f.input :present_tel_no , :required => true , :input_html => { :disabled => @read_only }%>

	<%= f.input :present_home_live , :as=>'date' ,:required => true , :input_html => { :disabled => @read_only }%>

	<%= f.input :present_home_position , :required => true , :input_html => { :disabled => @read_only }%>
	<%= f.input :present_home_characteristic , :required => true , :input_html => { :disabled => @read_only }%>
	<%= f.input :present_home_near , :input_html => { :disabled => @read_only }%>

	<%= f.input :contact_address ,:as=>'text', :required => true , :input_html => { :disabled => @read_only }%>

	<% end %>

	<%= f.inputs "Occupation" , :class=>"detail-form" do %>
	<%= f.input :occupation , :required => true , :input_html => { :disabled => @read_only }%>
	<%= f.input :work_position , :required => true , :input_html => { :disabled => @read_only }%>
	<%= f.input :work_name , :required => true , :input_html => { :disabled => @read_only }%>
	<%= f.input :work_address , :required => true , :input_html => { :disabled => @read_only }%>
	<%= f.input :work_tel_no , :required => true , :input_html => { :disabled => @read_only }%>
	<%= f.input :work_start , :required => true , :input_html => { :disabled => @read_only }%>
	<%= f.input :work_salary , :required => true , :input_html => { :disabled => @read_only }%>
	<%= f.input :other_income , :required => true , :input_html => { :disabled => @read_only }%>
	<% end %>
	<%= f.inputs "Internal" , :class=>"detail-form" do %>
	<%= f.input :branch ,:hint => "Default by current login user branch ("+@current_user.branch.name+")" ,:default => @current_user.branch ,:required => true, :input_html => { :disabled => @read_only }%>
	<%= f.input :black_list , :input_html => { :disabled => @read_only } %>
	<%= f.input :rate ,:as=>'select' , :collection => ["1", "2", "3", "4", "5"] , :input_html => { :disabled => @read_only }%>
	<% end %>
</div>
<div class="form-left">
	<%= f.inputs "Customer Image" , :class=>"detail-form" do %>
	<%if @read_only %>
	<% if @customer.image.exists? then %>
	<%= image_tag @customer.image.url(:medium) %>
	<% else %>
	<%= image_tag 'no-image-available.jpg' %>
	<% end %>
	<% end %>

	<%= f.input :image , :hint => "Support format jpeg,png,gif and maximum size 5 MB" , :as => :file , :input_html => { :disabled => @read_only } %>
	<% end %>
</div>
<%unless @read_only %>
<%= f.commit_button :button_html => { :class => "submit-button", :disable_with => 'Wait...' } %>
<% end %>
<% end %> 